﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;

namespace _016
{
    internal class Program
    {
        static void Main(string[] args)
        {
            #region
            /*
            //值类型
            int a = 10;
            byte b = 20;
            short c = 30;
            Console.WriteLine("我是值类型int:{0}，byte:{1}，short:{2}",a,b,c);
            //浮点类型
            float d = 93.32f;
            double e = 11.254d;
            Console.WriteLine("我是浮点类型float:{0}，double：{1}",d,e);
            //布尔类型
            bool x = true;
            Console.WriteLine("我是布尔类型，我的值是：{0}",x);
            int f, g;
            Console.WriteLine("请输入第一个数字：");
            f = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入第二个数字：");
            g = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("第一个数字为：{0},第二个数字为：{1},{2}+{3}={4}", f, g, f, g, f + g);
            string h, i;
            Console.WriteLine("请输入您的名字");
            h = Convert.ToString(Console.ReadLine());
            Console.WriteLine("请输入另外一个人的名字：");
            i = Convert.ToString(Console.ReadLine());
            Console.WriteLine("第一个人的名字是：{0}", h);
            Console.WriteLine("第二个人的名字是：{0}", i);
            Console.WriteLine("int类型的大小是：{0}" , sizeof(int));
            Console.WriteLine("bool的类型大小是：" + sizeof(bool));
            Console.WriteLine("byte的类型大小是：{0}" ,sizeof(byte));
            */
            #endregion
            #region
            /*
            //隐式转换
            int a = 200;
            double b = a;
            Console.WriteLine("b的值是：{0}",b);
            //显示转换
            double c = 789.34;
            int d;
            d = (int)c;
            Console.WriteLine("转换前{0},转换后{1}",c,d);
            //把数据类型转换成字符串
            int e = 90;
            float f = 34.343f;
            double g = 33.4343;
            bool h = true;
            Console.WriteLine(e.ToString()) ;
            Console.WriteLine(f.ToString());
            Console.WriteLine(g.ToString());
            Console.WriteLine(h.ToString());
            */
            #endregion
            #region
            /*
            Website site = new Website("C语言中文网", "http://c.biancheng.net/");
            site.Display();
            */
            #endregion
            #region
            /*
            Test test = new Test("C语言中文网");
            Console.ReadKey();
            */
            #endregion
            #region
            /*
            Test a = new Test();
            Console.WriteLine("Temp0:{0},Temp1:{1}", a[0], a[1]);
            a[0] = 15;
            a[1] = 20;
            Console.WriteLine("Temp0:{0},Temp1:{1}", a[0], a[1]);
            */
            #endregion
            #region
            /*
            string str = "C语言中文网";
            string newstr = str.ExpandString();
            Console.WriteLine(newstr);
            Console.ReadKey();
        }
    }
    public static class Test
    {
        public static string ExpandString(this string name)
        {
            return name + "http://c.biancheng.net/";
        }
    }
    #region
    /*
    public class Test
    {
        int Temp0;
        int Temp1;
        public int this[int index]
        {
            get
            {
                return (0 == index) ? Temp0 : Temp1;
            }
            set
            {
                if(0==index)
                {
                    Temp0 = value;
                }
                else
                {
                    Temp1 = value;
                }
            }
        }
        /*
        public Test()
        {
            Console.WriteLine("无参构造函数");
        }
        public Test(string text) : this()
        {
            Console.WriteLine(text);
            Console.WriteLine("实例化构造函数");
        }
        */
            #endregion
            #region
            /*
            Test.str = "C语言中文网";
            Console.WriteLine(Test.str);
            Test test1 = new Test();
            test1.getStr();

            Test test2 = new Test();
            test2.getStr();
            test2.setStr("http://c.biancheng.net/");
            test1.getStr();
            test2.getStr();
            Console.ReadKey();

        }
    }
    public class Test
    {
        public static string str;
        public void setStr(string s)
        {
            str = s;
        }
        public void getStr()
        {
            Console.WriteLine(str);
        }
    }*/
            #endregion
            Test test1 = new Test();
            test1.setStr("baidu");
            Test.getStr();
            Test test2 = new Test();
            test2.setStr("http://baidu.com/");
            Test.getStr();
            Console.ReadKey();

        }
    }
    public class Test
    {
        public static string str;
        public void setStr(string s)
        {
            str = s;
        }
        public static void getStr()
        {
            Console.WriteLine(str);
        }
    }
}
